﻿// VsPkg.cs : Implementation of TransformDslExt
//

using System;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.ComponentModel.Design;
using Microsoft.Win32;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.TextTemplating.VSHost;

namespace Planet.TransformDslExt
{
    [PackageRegistration(UseManagedResourcesOnly = true)]
    [DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\9.0")]
    [InstalledProductRegistration(false, "#110", "#112", "1.0", IconResourceID = 400)]
    [ProvideLoadKey("Standard", "1.0", "TransformDslExt", "Planet", 1)]
    [ProvideMenuResource(1000, 1)]
    //[ProvideService(typeof(STextTemplating))]
    [ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")]
    [Guid(GuidList.guidTransformDslExtPkgString)]
    public sealed class TransformDslExtPackage : Package
    {
        public TransformDslExtPackage()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
        }



        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();
            new TransformCommandSet(this);
            this.AddService();
        }

        private void AddService()
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
            ((IServiceContainer)this).AddService(typeof(STextTemplating), callback, true);
        }

        private object OnCreateService(IServiceContainer container, Type serviceType)
        {
            if (serviceType != typeof(STextTemplating))
            {
                return null;
            }

            return null;
        }

 


        #endregion
    }
}